/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aic.lists;

import aic.beans.Address;
import aic.misc.DebugPrint;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class AddressList {

    private static List<Address> addressList = Collections.synchronizedList(new LinkedList<Address>());

    public static boolean add(Address address) {
        DebugPrint.println("adding Address: "+address);
        return addressList.add(address);
    }

    public static boolean contains(Address address) {
        boolean ret = addressList.contains(address);
        DebugPrint.println("Customer "+address+" is in the list: "+ret);
        return addressList.contains(address);
    }

    /**
     * Prints out a list of all Addresses within "addressList"
     */
    public static void printList() {
        Iterator it = addressList.iterator();

        while (it.hasNext()) {
            System.out.println(">>list value (addressList): " + it.next());
        }
    }
}
